{% load staticfiles %}
<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title>产品修改</title>
    <link rel="stylesheet" type="text/css" href="{% static 'css/bootstrap.min.css' %}">
    <script src="{% static 'js/jquery.min.js' %}"></script>
    <script src="{% static 'js/bootstrap.min.js' %}"></script>
</head>
<body>

  
  <form class="form-horizontal" method="post" action={% url 'update' product.id%}>
    {% csrf_token %}
    <fieldset>
      <div id="legend" class="">
        <legend class="">修改产品</legend>
      </div>
    

    <div class="control-group">

          <!-- Text input-->
          <label class="control-label" for="input01">产品名</label>
          <div class="controls">
            <input type="text" value="{{ product.name }}" class="input-xlarge" name = "product_name">
            <p class="help-block"></p>
          </div>
        </div>

    

    <div class="control-group">

          <!-- Select Basic -->
          <label class="control-label">产品型号</label>
          <div class="controls">
            <select class="input-xlarge" name = "product_spec">
      <option value="1"{% ifequal product.spec '1' %}selected{% endifequal %}>大号</option>
      <option value="2"{% ifequal product.spec '2' %}selected{% endifequal %}>中号</option>
      <option value="3"{% ifequal product.spec '3' %}selected{% endifequal %}>小号</option></select>
          </div>

        </div>

    <div class="control-group">

          <!-- Select Basic -->
          <label class="control-label">产品类别</label>
          <div class="controls">
            <select class="input-xlarge" name = "product_category">
                {% for category in categorys %}
                    <option value={{ category.id }} {% ifequal product.cate category %}selected{% endifequal %}>{{ category.name }}</option>
                {% endfor %}

            </select>
          </div>

        </div>

    <div class="control-group">

          <!-- Text input-->
          <label class="control-label" for="input01">库存数量</label>
          <div class="controls">
            <input type="text" value="{{ product.stock }}" class="input-xlarge" name = "product_stock">
            <p class="help-block"></p>
          </div>
        </div>
        <div class="control-group">

          <!-- Text input-->
          <label class="control-label" for="input01">产品价格</label>
          <div class="controls">
            <input type="text" value="{{ product.price }}" class="input-xlarge" name = "product_price">
            <p class="help-block"></p>
          </div>
        </div>
        <div class="control-group">

          <!-- Select Multiple -->
          <label class="control-label">产品关键词</label>
          <div class="controls">
            <select class="input-xlarge" multiple="multiple" name = "product_key">
                {% for key in keywords %}
                    <option value={{ key.id }} {% if key in product.key.all %}selected{% endif %}>{{ key.name }}</option>
                {% endfor %}
            </select>

          </div>
        </div>
        <div class="control-group">

          <!-- Textarea -->
          <label class="control-label">产品描述</label>
          <div class="controls">
            <div class="textarea">
                  <textarea type="" class="" name = "product_desc">{{ product.desc }} </textarea>
            </div>
          </div>
        </div>

    <div class="control-group">
          <label class="control-label"></label>

          <!-- Button -->
          <div class="controls">
            <button class="btn btn-primary">修改</button>
          </div>
        </div>

    </fieldset>
  </form>


</body>
</html>